Skip to content

Conversation

@sergerad
Copy link
Collaborator

@sergerad sergerad commented Jan 9, 2026

Context

The Validator's TransactionInputsDataStore does not handle foreign accounts for the purposes of the following functions of DataStore trait:

  • get_foreign_account_inputs()

NOTE: This will remain in draft until miden-base has the TransactionIniputs::read_foreign_account_inputs() functionality merged into next.

A followup PR will be made to add similar functionality to the NtxDataStore.

Relates to #1387 and #1305.

Changes

  • Update TransactionInputsDataStore to handle foreign accounts through self.tx_inputs.

@Mirko-von-Leipzig Mirko-von-Leipzig changed the title Add foreign account data impls to TransactionInputsDataStore feat(validator): FPI support in data store Jan 9, 2026
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left just one small nit inline.

Also, would be good to get a review from @igamigo. Maybe we can run client integration tests against this branch to confirm that transactions that do FPI calls can indeed be accepted by the node.

@sergerad sergerad requested a review from igamigo January 18, 2026 21:06
@sergerad
Copy link
Collaborator Author

Maybe we can run client integration tests against this branch to confirm that transactions that do FPI calls can indeed be accepted by the node.

I tried running the tests from miden-client next against this but they are not compatible. That is after I merged miden-node next into this branch.

if self.tx_inputs.account().id() == account_id {
// Get asset witnessess from native account.
Result::<Vec<_>, _>::from_iter(vault_keys.into_iter().map(|vault_key| {
match self.tx_inputs.account().vault().open(vault_key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The native account's witnesses are handled just like the ones for foreign accounts, i.e. they are added to the advice inputs on lazy loading, but not to the PartialVault. Any asset witnesses that are present in the partial vault at the beginning are also added to the advice inputs.

So, the advice inputs contain both the pre-provided asset witnesses and those fetched during lazy loading, and so we should read from the advice inputs and not from the partial vault.

The need for this should go away with 0xMiden/miden-base#2298 completely, at which point this could be replaced with unimplemented!.

Because of these subtle differences, I still think it would be good to add a test for this, e.g. one that has an FPI call, reads a storage map item lazily and has input notes with some assets, so the pre-fetch is executed.

And then all of these annoying details should be abstracted away once we have a re-execution API exposed in base directly: 0xMiden/miden-base#2293.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xMiden/miden-base#2298 has been merged so I have moved this to unimplemented

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xMiden/miden-base#2298 is not a part of v0.13.0 release - it went into next. So, we can't make use of it in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I didn't review TransactionInputs::read_foreign_account_inputs but I assume that was properly tested. We'll update the client today now that the protocol was upgraded here, so we'll be able to run integration tests and see how it goes.

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I'll merge as as - but let's consider adding a test in a follow-up PR.

@bobbinth bobbinth merged commit 976566a into next Jan 20, 2026
18 checks passed
@bobbinth bobbinth deleted the sergerad-validator-foreign branch January 20, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants